package utils;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 34255
 * Date: 2024-10-04
 * Time: 21:26
 */
public class Demo2 {
    public static void main(String[] args) throws Exception{
        //获取数据库连接对象
        Connection connection = DBUtils.getConnection();

        //编写sql语句
        String sql = "select * from 管理员";

        //获取sql执行对象
        Statement statement = connection.createStatement();

        //执行sql
        ResultSet resultSet = statement.executeQuery(sql);

        //处理结果
        if(resultSet.next()){
            System.out.println("执行成功！！！");
        }else{
            System.out.println("执行失败！！！");
        }

        //关闭资源
        DBUtils.close(connection,statement,resultSet);
    }
}
